/*
* This file is the main code of Timeless
* Copyright (C) <2019>  <alkeon> [alkeon@autistici.org]
*
* Texdi is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Texdi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with timeless.  If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include "parser.h"
#include "datalite.h"
using namespace std;
int main(int argc, char *argv[]){
	cout << "TIMELESS" << endl;
	if(argc > 1){
		string load(argv[1]);
		if(load == "--new")
			datalite d("news");
		else if(load == "--help"){
				cout << "Help menu" << endl;
				cout << "tm --new -- Start news database" << endl;
				cout << "tm --get-news -- Download and read news" << endl;
				cout << "tm --clean-news -- Delete not marked news" << endl;
				cout << "tm --help -- Help" << endl;
		}else if(load == "--get-news"){
			parser p;
			p.get_news();
		}else if(load == "--clean-news"){
			datalite d;
			d.set_file("news");
			d.delete_news();
		}
	}else{
		datalite d;
		d.set_file("news");
		d.show_news();
	}
}
